feat: gate configurable top nav behind navigation-preview flag; de-viralize TopNav - #3869
Merged
theletterf merged 4 commits intoAug 14, 2026
Conversation
theletterf
approved these changes
Aug 14, 2026
…ralize TopNav - Move SectionTopNavBuilder to Elastic.Documentation.Navigation.Assembler so SiteNavigation can own TopNav without an assembler dependency - Add ISiteNavigationRoot interface and implement it on SiteNavigation; TopNav is computed in the SiteNavigation ctor only when navigationPreviewEnabled=true - Pass navigationPreviewEnabled into SiteNavigation from AssemblerBuildService; remove the unconditional fan-out loop that set TopNav on every BuildContext - Remove TopNav from BuildContext, HtmlWriter, IndexViewModel, Index.cshtml; GlobalLayoutViewModel.TopNav is now a derived property that walks the parent chain to the first ISiteNavigationRoot - _SecondaryNav.cshtml branches at the container level — flag-off path restores main's exact justify-between + Docs link markup, no overflow-x-auto - GlobalNavigationHtmlWriter: isUsingNavigationDropdown = globalNavigation.TopNav is null so the sidebar pages-dropdown is on when the top nav is absent (prod) and off when it takes over (nav-preview builds) - Restore initListing import and htmx:load registration in main.ts (regression from PR #3781 merge) - Restore #pages-dropdown synthetics step; synthetics exercise prod-shaped builds - Update SecondaryNavRenderingTests to derive TopNav via MockSiteNavigationRoot parent chain instead of assigning it directly on GlobalLayoutViewModel Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ag-off path The assembler build defaults to 'dev' when no environment is matched, and 'dev' has NAVIGATION_PREVIEW: true. The CI synthetics job runs with '-c local', which previously fell through to 'dev', making TopNav non-null and hiding #pages-dropdown. 'local' is a temporary environment matching the CI setup (no NAVIGATION_PREVIEW) so the flag-off secondary-nav path remains testable until NAVIGATION_PREVIEW is retired as a flag and becomes the default. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dropdown The pages-dropdown SVG click was timing out in CI (local environment, flag-off path). Both flag-off (#secondary-nav built-in Reference link) and flag-on (top-nav Reference tab) render a Reference link inside #secondary-nav, making this approach reliable in both states. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
theletterf
force-pushed
the
feature/top-nav-behind-feature-flag
branch
from
August 14, 2026 13:02
914d378 to
7d6eabc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
navigation-previewis enabled (dev/previewenvironments, orFEATURE_NAVIGATION_PREVIEW=true). Prod (navigation.yml) renders byte-for-byte as before.TopNavfromBuildContext→HtmlWriter→IndexViewModel→Index.cshtml→GlobalLayoutViewModel. It is now a derived property that walksCurrentNavigationItem.Parentup to the firstISiteNavigationRoot— implemented bySiteNavigationand computed in its constructor only when the flag is on.SectionTopNavBuildermoved fromElastic.Documentation.Assembler.NavigationtoElastic.Documentation.Navigation.Assembler(besideSectionNavigation) soSiteNavigationownsTopNavwithout an assembler-layer dependency._SecondaryNav.cshtmlbranched at the container level: flag-off path restores main's exactjustify-between+Docsbrand link; flag-on path gets thejustify-startscrollable container.isUsingNavigationDropdown = globalNavigation.TopNav is nullso the dropdown is on when there is no top nav (prod) and off when the top nav takes over.initListingregression fixed: commit1722e573fhad dropped both the import andhtmx:loadregistration; restored inmain.ts.#pages-dropdownstep back; synthetics exercise prod-shaped builds.Stacks on #3792 and #3867.
Closes: follow-up tracking issue filed separately — "Navigation 1st principles hardening".
Test plan
dotnet build— zero errorsdotnet test tests/Navigation.Tests/— 224/224 passednpm run test— 170/170 passednpm run compile:check— clean./build.sh unit-test— 2,411 C# tests, 0 failures./build.sh lint) — no violations<nav id="secondary-nav">block + one sidebar)--environment devassembler build — Guides tab active on get-started page, Reference tab active on reference page🤖 Generated with Claude Code